package com.ssy.lingxi.product.entity.commodity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 商品描述图片对象
 * @author jw.chen
 * @version 2.0.0
 * @date 2021/8/20
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "product_commodity_remark_image")
public class CommodityRemarkImage implements Serializable {
    private static final long serialVersionUID = -368751993151835191L;

    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="commodity_remark_image_seq")
    @SequenceGenerator(sequenceName="product_commodity_remark_image_seq", name="commodity_remark_image_seq",allocationSize = 1)
    private Long id;

    /**
     * 商品描述
     */
    @JsonIgnore
    @ManyToOne(cascade = {CascadeType.PERSIST})
    @JoinColumn(name="commodityRemarkId",referencedColumnName = "id")
    private CommodityRemark commodityRemark;

    /**
     * 图片路径
     */
    @Column(columnDefinition = "varchar(500)", nullable = false)
    private String url;

    /**
     * 图片链接类型: 1-外部链接; 2-内部链接;
     */
    @Column(columnDefinition = "int", nullable = false)
    private Integer linkType = 1;

    /**
     * 图片链接
     */
    @Column(columnDefinition = "text")
    private String link;

    /**
     * 图片类型: 1-商品描述图片; 2-厂商资质图片; 3-商品检测报告图片;
     */
    @Column(columnDefinition = "int")
    private Integer imageType = 1;
}
